home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / dev / c / llist1_1.lha / linked_list / linklist.fw (.txt) < prev    next >
Encoding:
Final Write Document  |  1995-03-20  |  250.3 KB  |  1,979 lines

  1.  
  2.  
  3.  
  4.  
  5. Linked List Library
  6.  
  7. Programmers Reference
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29. version 1.1
  30.  
  31.  
  32. Well, I finally got tired of writing programs with linked lists in them and 
  33. forgetting how to do it.  I would sit there for about an hour trying to dig up 
  34. old source code or remembering how to do it.  Enough of that.  I took about a 
  35. week and developed a library with some of the basic functions to use with these 
  36. lists.  There are duplicate functions for three types of lists: single (forward 
  37. only), double (forward and back), and circular (no start no end).
  38.  
  39. The C structures for these lists are also defined.  There is a pointer in them 
  40. to be used for data.  I'm not saying you have to use these structures but it 
  41. might make programming with this library a bit easier.
  42.  
  43. This code was developed on an Amiga 3000 with the SAS C compiler version 6.3.  
  44. It was tested with the Memlib library to ensure there were no memory leaks.  
  45. That's not to say any code developed with this won't be memory bug free.  I'm 
  46. not taking any responsibility for poor memory handling.  If you don't know 
  47. exactly what a linked list is or how to allocate memory, use it, and then FREE 
  48. it, please learn before releasing code with this library.  Although I tried to 
  49. make it idiot proof there is only so much one can do.  I hope this code is 
  50. useful.
  51.  
  52. Copyright © 1995 
  53. John Brooks
  54.  
  55. There are no restrictions on the use of this library to develop and market 
  56. software products, free or commercial.  Disassembly and / or modification of  
  57. the library or documentation is not allowed without permission from the author.
  58.  
  59. If you like it and use it a lot I'm always willing to take donations.
  60.  
  61. Any questions, comments, or suggestions, please feel free to contact me at
  62.  
  63. John Brooks
  64. 461 3rd Ave
  65. Satellite Bch, FL 32937
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72. SAS/C
  73. ®
  74.  Copyright © 1992 by SAS Institute Inc., Cary, NC, USA
  75. Memlib was written and copyrighted © 1988-1992 by Doug Walker
  76. Preface
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125. Programmers Reference
  126.  
  127. 1. Header File
  128.     
  129.  
  130. 1.1 Structures
  131.     
  132. 1
  133. 1.2 Functions
  134.     
  135. 1
  136.  
  137. 2. Library Functions
  138.     
  139.  
  140. 2.1 Standard Functions
  141.     
  142. 4
  143. 2.2 Single List Functions
  144.     
  145. 5
  146. 2.4 Circular List Functions
  147.     
  148. 16
  149.  
  150. 3. Example Code
  151.     
  152.  
  153. 3.1 Code example for single linked lists
  154.     
  155. 20
  156. 3.2 Code example for double linked lists
  157.     
  158. 22
  159. 3.3 Code example for circular linked lists
  160.     
  161. 24
  162.  
  163. Appendix A
  164.     
  165.  
  166. Code History and Changes
  167.     
  168. 27
  169.  
  170. Index
  171.     
  172.  
  173.  
  174.  
  175. 1. Header File
  176.  
  177. As with most C libraries a header file is used to tell the compiler how to 
  178. access and use the library.  No difference here.  The header file name is 
  179. linklist.h
  180. .
  181.   It allows access into the library called 
  182. linklist.lib
  183. .  The header file itself is really not that useful for the programmer when 
  184. trying to figure out what arguments to pass to functions.  About the most one 
  185. can get out of this header file is the argument types.  Defined within 
  186. linklist.h
  187.  are the structures of the three linked lists and the functions contained in 
  188. the library.  The functions are defined as prototypes.
  189.  
  190. 1.1 Structures
  191.  
  192. The structures for single, double, and circle linked lists are defined in the 
  193. header file.  They all have a pointer to another link, next and/or previous, 
  194. and a void pointer that can be used to store other data.  Since the pointer for 
  195. the data is void, typedef'ing will more than likely need to be done if the 
  196. pointer is used in another function call that requires a specific type.
  197.  
  198. These structures are there as a convenience.  A custom structure may be used 
  199. but it will have to be typedef'ed to keep the compiler from crying.  The 
  200. pointers to the next and/or previous links will need to be in the same order in 
  201. the structure as they are in the header file so when they are passed to a 
  202. function it uses the correct memory location to find the next link.  Don't do 
  203. this and expect programs to act strange and probably crash.
  204.  
  205. single link struct
  206.  
  207. typedef struct _single {
  208.     
  209. struct _single
  210.     
  211.     
  212. *next;
  213.     
  214. void
  215.     
  216.     
  217.     
  218.     
  219.     
  220. *data;
  221. } Single;
  222.  
  223. double link struct
  224.  
  225. typedef struct _double {
  226.     
  227. struct _double
  228.     
  229.     
  230. *next;
  231.     
  232. struct _double
  233.     
  234.     
  235. *prev;
  236.     
  237. void
  238.     
  239.     
  240.     
  241.     
  242.     
  243. *data;
  244. } Double;
  245.  
  246. circular link struct
  247.  
  248. typedef struct _circle {
  249.     
  250. struct _circle
  251.     
  252.     
  253. *next;
  254.     
  255. void
  256.     
  257.     
  258.     
  259.     
  260.     
  261. *data;
  262. } Circle;
  263.  
  264. 1.2 Functions
  265.  
  266. As with the structures, several functions for the three types of linked lists 
  267. are also defined in the header.  There are also functions for all types of 
  268. linked lists.  These functions have the prefix 
  269. std
  270. .  The functions for single lists start with 
  271. single
  272. , double prefix with 
  273. double
  274. , and circles have the prefix 
  275. circle
  276. .
  277.  
  278. A lot of the functions are similar between the three types.  In fact there is a 
  279. lot of duplicate code within the library.  None of the functions are dependant 
  280. to any other library functions.  This was done to keep the speed up.  Also, 
  281. there is no recursion in any of the functions.  The library is relatively small 
  282. so space was not a big concern.
  283.  
  284. When using these functions it would be a good idea to keep track of the head of 
  285. the list especially the single lists.  Because of their nature, when the head 
  286. pointer is lost it is impossible to find the start of the list and here comes 
  287. the memory leak.  With the double the start can be found and memory leaks are 
  288. easier to prevent.  When using some of the circular functions, such as delete, 
  289. the 'head' can no longer be 'trusted' to point to the next link correctly so 
  290. the most stable link closest to the pointer passed into the function is 
  291. returned.  Since the list is circular this is not a big problem.
  292.  
  293. standard list functions
  294.  
  295. void
  296.     
  297.     
  298. *stdGetNewLink (int)
  299.  
  300. single list functions
  301.  
  302. Single
  303.     
  304. *singleGetNewLink (void)
  305. Single
  306.     
  307. *singleAttachBegin (Single *, Single *)
  308. Single
  309.     
  310. *singleAttachEnd (Single *, Single *)
  311. Single
  312.     
  313. *singleInsertLink (Single *, Single *)
  314. Single
  315.     
  316. *singleDeleteLink (Single *, Single *)
  317. Single
  318.     
  319. *singleSearch (void *, Single *)
  320. Single
  321.     
  322. *singleFindEnd (Single *)
  323. void
  324.     
  325.     
  326.  singleDestroyList (Single *)
  327.  
  328. double list functions
  329.  
  330. Double
  331.     
  332. *doubleGetNewLink (void)
  333. Double
  334.     
  335. *doubleAttachBegin (Double *, Double *)
  336. Double
  337.     
  338. *doubleAttachEnd (Double *, Double *)
  339. Double
  340.     
  341. *doubleInsertLink (Double *, Double *)
  342. Double
  343.     
  344. *doubleDeleteLink (Double *, Double *)
  345. Double
  346.     
  347. *doubleFindBegin (Double *)
  348. Double
  349.     
  350. *doubleFindEnd (Double *)
  351. Double
  352.     
  353. *doubleSearch (void *, Double *)
  354. void
  355.     
  356.     
  357.  doubleDestroyList (Double *)
  358.  
  359. circular list functions
  360.  
  361. Circle
  362.     
  363. *circleGetNewLink (void)
  364. Circle
  365.     
  366. *circleStartList (Circle *)
  367. Circle
  368.     
  369. *circleAttachEnd (Circle *, Circle *)
  370. Circle
  371.     
  372. *circleInsertLink (Circle *, Circle *)
  373. Circle
  374.     
  375. *circleDeleteLink (Circle *, Circle *)
  376. Circle
  377.     
  378. *circleSearch (void *, Circle *)
  379. void
  380.     
  381.     
  382.  circleDestroyList (Circle *)
  383. Header File
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432. Programmers Reference
  433.     
  434.     
  435.     
  436.     
  437.     
  438.     
  439.     
  440.     
  441.  
  442. Page 1
  443.  
  444. 2. Library Functions
  445.  
  446. This chapter will explain in detail each of the functions contained in the 
  447. library.  There will be an example of how to use the code as part of the 
  448. description.  In the next chapter there are example programs which hopefully 
  449. show more on the use of these functions.
  450.  
  451. 2.1 Standard Functions
  452.  
  453. These functions can be used with any linked list.  Since they are pretty 
  454. generic, typedef'ing will more than likely be used to keep the compiler quiet.
  455.  
  456. stdGetNewLink
  457.  
  458. void *stdGetNewLink (size)
  459. int
  460.     
  461. size;
  462.  
  463. This function returns a pointer to the amount of memory allocated in the 
  464. argument 
  465. size
  466. .  The pointer will probably have to be typedef'ed into a useful type.  This 
  467. function's primary use is to get memory for any user created structures.
  468.  
  469. example:
  470.  
  471. #include "linklist.h"
  472.  
  473. main ()
  474. {
  475.     
  476. S
  477. ingle  *link;
  478.     
  479. ...
  480.  
  481.     
  482. link = (Single *)stdGetNewLink (sizeof (Single));
  483.     
  484. ...
  485. }
  486.  
  487. error: returns NULL if the memory could not be allocated.
  488.  
  489. 2.2 Single List Functions
  490.  
  491. The following functions are used with the single linked list.  If a different 
  492. structure is used with these functions, problems can occur with the memory 
  493. bounds of pointers.  To ensure this doesn't happen the structures used with the 
  494. single functions should be the same size as the defined single structure.
  495.  
  496. singleAttachBegin
  497.  
  498. Single *singleAttachBegin (list, link)
  499. Single *list;
  500. Single *link;
  501.  
  502. Attaches the new link to the start of the list and returns the pointer to the 
  503. start of the new list.
  504.  
  505. example:
  506.  
  507. #include "linklist.h"
  508.  
  509. main ()
  510. {
  511.     
  512. Single  *list, *link;
  513.     
  514. ...
  515.  
  516.     
  517. link = singleGetNewLink ();
  518.     
  519. list = singleAttachBegin (list, link);
  520.     
  521. ...
  522. }
  523.  
  524. NOTE: The first argument to this function 
  525. must
  526.  be the start of the list or a serious memory leak can and will occur.
  527.  
  528. error: returns a NULL if either of the arguments is an invalid pointer.
  529.  
  530. singleAttachEnd
  531.  
  532. Single *singleAttachEnd (list, link)
  533. Single *list;
  534. Single *link;
  535.  
  536. The function returns the pointer to the same list that was passed in as the 
  537. first argument.  The pointer to the link will be attached to the end of the 
  538. list.
  539.  
  540. example:
  541.  
  542. #include "linklist.h"
  543.  
  544. main ()
  545. {
  546.     
  547. Single *list, *link;
  548.     
  549. ...
  550.  
  551.     
  552. link = singleGetNewLink ();
  553.     
  554. list = singleAttachEnd (list, link);
  555.     
  556. ...
  557. }
  558.  
  559. The first
  560.  argument doesn't have to be the start of the list.  It is a little quicker if 
  561. the 
  562. list
  563.  argument is somewhere deeper into the list.  The big problem is when a pointer 
  564. to the start of the list is not maintained a memory leak occurs and also loss 
  565. of data.
  566.  
  567. error: returns NULL if either of the arguments is an invalid pointer.
  568.  
  569. singleDeleteLink
  570.  
  571. Single *singleDeleteLink (list, link)
  572. Single *list;
  573. Single *link;
  574.  
  575. This function is used to remove a link from the list.  Since it is technically 
  576. a memory bug to free memory that is not allocated (Memlib complains) the 
  577. function makes sure the link is in the list before freeing and setting the 
  578. pointers of the other links.  If the link is not part of the list it must be 
  579. freed by the programmer or attached to the link before it can be freed with 
  580. this call.  The arguments are the pointer to the list and the link being 
  581. removed.  The pointer to the new list is returned.
  582.  
  583. example:
  584.  
  585. #include "linklist.h"
  586.  
  587. main ()
  588. {
  589.     
  590. Single *list, *link;
  591.     
  592. ...
  593.  
  594.     
  595. list = singleDeleteLink (list, link);
  596.     
  597. ...
  598. }
  599.  
  600. As with 
  601. singleAttachEnd()
  602.  the argument list doesn't have to be the start of the list to help speed 
  603. things up, but the same memory leak and data loss potential is there.
  604.  
  605. error: returns a NULL if either of the arguments is an invalid pointer.
  606.  
  607. singleDestroyList
  608.  
  609. void singleDestroyList (list)
  610. Single *list;
  611.  
  612. The use of this function is pretty much straight forward - destroy the whole 
  613. list.  The function parses through the list to find the end and then one by one 
  614. frees the memory to each link.
  615.  
  616. NOTE: This function does not free the memory pointed to by the 
  617. Single->data
  618.  pointer.  It would be simple to do this but if it was a pointer to another 
  619. structure that had memory pointer in it, there would be serious memory leaks.  
  620. Any memory that has been allocated inside this pointer must be freed before 
  621. calling this function.
  622.  
  623. example:
  624.  
  625. #include "linklist.h"
  626.  
  627. main()
  628.  
  629. {
  630.     
  631. Single *list;
  632.     
  633. ...
  634.  
  635.     
  636. singleDestroyList (list);
  637.     
  638. exit (0);
  639. }
  640.  
  641. error: no error condition is returned.  If the pointer is invalid, the function 
  642. returns without releasing the memory to the system.
  643.  
  644. singleFindEnd
  645.  
  646. Single *singleFindEnd (list)
  647. Single *list;
  648.  
  649. This function is pretty much self explanatory.  Its only argument is the list 
  650. and it returns a pointer to the last link of that list.
  651.  
  652. example:
  653.  
  654. #include "linklist.h"
  655.  
  656. main ()
  657. {
  658.     
  659. Single *list;
  660.     
  661. ...
  662.  
  663.     
  664. /* remove the last link of the list */
  665.     
  666. list = singleDeleteLink (list, singleFindEnd (list));
  667.     
  668. ...
  669. }
  670.  
  671. error: NULL is returned if the argument is an invalid pointer.
  672.  
  673. singleGetNewLink
  674.  
  675. Single *singleGetNewLink (void)
  676.  
  677. This function returns a pointer of type 
  678. single
  679.  to the allocated memory.  Typedef the function if a different pointer type is 
  680. being used.
  681.  
  682. example:
  683.  
  684. #include "linklist.h"
  685.  
  686. main ()
  687. {
  688.     
  689. Single *link;
  690.     
  691. link = singleGetNewLink ();
  692. }
  693.  
  694. error: returns NULL if the memory could not be allocated.
  695.  
  696. singleInsertLink
  697.  
  698. Single *singleInsertLink (before, new)
  699. Single *before;
  700. Single *after;
  701.  
  702. This function is used when a link needs to be inserted somewhere inside the 
  703. list.  This function can be used to attach a link to the end of the list.  The 
  704. preferred way is to use 
  705. singleAttachEnd()
  706. .  The pointer to the first argument is returned.
  707.  
  708. example:
  709.  
  710. #include "linklist.h"
  711.  
  712. main()
  713. {
  714.     
  715. Single *list, *new_link;
  716.     
  717. ...
  718.  
  719.     
  720. list = singleInsertLink (list, new_link);
  721.     
  722. ...
  723. }
  724.  
  725. error: returns NULL if either of the pointers are invalid.
  726.  
  727. singleSearch
  728.  
  729. Single *singleSearch (data, list)
  730. void   *data;
  731. Single *list;
  732.  
  733. This function may be a little tricky and rarely used.  It requires some pointer 
  734. that will be compared to the 
  735. Single->data
  736.  part of the structure.  The other argument is the list to be searched.  It 
  737. returns the link if found or NULL if not.
  738.  
  739. example:
  740.  
  741. #include "linklist.h"
  742.  
  743. main()
  744. {
  745.     
  746. Single *list, *link;
  747.     
  748. char   *data = "data";
  749.     
  750. ...
  751.  
  752.     
  753. link->data = data;
  754.     
  755. ...
  756.  
  757.     
  758. if ( !(singleSearch (data, list)))
  759.     
  760.     
  761. printf ("Data not found\n");
  762.     
  763. ...
  764. }
  765.  
  766. error: returns a NULL if the second argument is an invalid pointer.
  767.  
  768. 2.3 Double List Func
  769. tions
  770.  
  771. These following functions are for double linked lists.  Again, the predefined 
  772. structures don't have to be used but make sure that any user defined structures 
  773. have the same basic format to prevent any weird memory and/or pointer problems.
  774.  
  775.  
  776. doubleAttachBegin
  777.  
  778. Double *doubleAttachBegin (list, link)
  779. Double *list;
  780. Double *link;
  781.  
  782. This function parses through the list and attaches the link to the start.  The 
  783. pointer to the new list is returned, not necessarily the start of the list.
  784.  
  785. example:
  786.  
  787. #include "linklist.h"
  788.  
  789. main ()
  790. {
  791.     
  792. Double *list;
  793.     
  794. ...
  795.  
  796.     
  797. list = doubleAttachBegin (list, doubleGetNewLink());
  798.     
  799. ...
  800. }
  801.  
  802. As with the attach function with the single lists, the first argument can be 
  803. any link on the list.  The only difference here is that a pointer to the head 
  804. doesn't have to be kept since the start can be found.
  805.  
  806. error: a NULL is returned if either of the arguments are invalid pointers.
  807.  
  808. doubleAttachEnd
  809.  
  810. Double *doubleAttachEnd (list, link)
  811. Double *list;
  812. Double *link;
  813.  
  814. This function is identical to 
  815. doubleAttachBegin()
  816.  except that it puts the link at the end of the list.
  817.  
  818. example:
  819.  
  820. #include "linklist.h"
  821.  
  822. main()
  823. {
  824.     
  825. Double *list;
  826.     
  827. ...
  828.  
  829.     
  830. list = doubleAttachEnd (list, doubleGetNewLink());
  831.     
  832. ...
  833. }
  834.  
  835. error: if the arguments are invalid pointers then a NULL is returned.
  836.  
  837. doubleDeleteLink
  838.  
  839. Double *doubleDeleteLink (list, link)
  840. Double *list;
  841. Double *link;
  842.  
  843. This function is used to remove a link from the list.  The function will not 
  844. free any memory allocated by the 
  845. Double->data
  846.  pointer.  This memory, and any memory further in, must be freed before the 
  847. link is destroyed in order to prevent memory leaks.  The pointer to the new 
  848. list is returned.
  849.  
  850. example:
  851.  
  852. #include "linklist.h"
  853.  
  854. main ()
  855. {
  856.     
  857. Double *list, *link;
  858.     
  859. ...
  860.  
  861.     
  862. list = doubleDeleteLink (list, link);
  863.     
  864. ...
  865. }
  866.  
  867. error: if either of the arguments are invalid pointers, a NULL is returned.
  868.  
  869. doubleDestroyList
  870.  
  871. void doubleDestroyList (list)
  872. Double *list;
  873.  
  874. The use of this function is pretty much straight forward - destroy the whole 
  875. list.  The function parses through the list to find the end and then one by one 
  876. frees the memory to each link.
  877.  
  878. NOTE: This function does not free the memory pointed to by the 
  879. Double->data
  880.  pointer.  It would be simple to do this but if it was a pointer to another 
  881. structure that had memory pointer in it, there would be serious memory leaks.  
  882. Any memory that has been allocated inside this pointer must be freed before 
  883. calling this function.
  884.  
  885. example:
  886.  
  887. #include "linklist.h"
  888.  
  889. main ()
  890. {
  891.     
  892. Double *list;
  893.     
  894. ...
  895.  
  896.     
  897. doubleDestroyList (list);
  898.     
  899. exit (0);
  900. }
  901.  
  902. error: if the pointer passed to the function is invalid, the function will not 
  903. execute.  No error condition is returned.
  904.  
  905. doubleFindBegin
  906.  
  907. Double *doubleFindBegin (list)
  908. Double *list;
  909.  
  910. This function accepts the list as its only arguement and then parses back 
  911. through it returning the pointer to the first link in the list.
  912.  
  913. example:
  914.  
  915. #include "linklist.h"
  916.  
  917. main ()
  918. {
  919.     
  920. Double *list, *link;
  921.     
  922. ...
  923.  
  924.     
  925. list = doubleAttachBegin (list, link);
  926.     
  927. /* make sure that list is pointing to the head */
  928.     
  929. list = doubleFindBegin (list);
  930.     
  931. ...
  932. }
  933.  
  934. error: if the pointer passed to the function is not valid, then a NULL is 
  935. returned.
  936.  
  937. doubleFindEnd
  938.  
  939. Double *doubleFindEnd (list)
  940. Double *list;
  941.  
  942. This function is identical to the previous except that it finds the end of the 
  943. list instead of the start.
  944.  
  945. example:
  946.  
  947. #include "linklist.h"
  948.  
  949. main ()
  950. {
  951.     
  952. Double *list;
  953.     
  954. ...
  955.  
  956.     
  957. /* remove the last link in the list */
  958.     
  959. list = doubleDeleteLink (list, doubleFindEnd (list));
  960.     
  961. ...
  962. }
  963.  
  964. error: a NULL is returned if the argument is an invalid pointer.
  965.  
  966. doubleGetNewLink
  967.  
  968. Double *doubleGetNewLink (void)
  969.  
  970. This function returns a pointer to the new link.
  971.  
  972. example:
  973.  
  974. #include "linklist.h"
  975.  
  976. main ()
  977. {
  978.     
  979. Double *link;
  980.     
  981. ...
  982.  
  983.     
  984. link = doubleGetNewLink ();
  985.     
  986. ...
  987.  
  988. }
  989.  
  990. error: a NULL is returned if the memory couldn't be allocated for the pointer.
  991.  
  992. doubleInsertLink
  993.  
  994. Double *doubleInsertLink (before, new)
  995. Double *before;
  996. Double *new;
  997.  
  998. This function is almost identical to 
  999. singleInsertLink()
  1000. .  It is used to insert a link somewhere in the list.  This function can be 
  1001. used to attach a link to the end of the list.  The preferred method is with 
  1002. doubleAttachEnd()
  1003. .  Do not use this function to attach a link to the head of  the list, use
  1004.  
  1005. doubleAttachBegin()
  1006.  instead.
  1007.  
  1008. example:
  1009.  
  1010. #include "linklist.h"
  1011.  
  1012. main ()
  1013. {
  1014.     
  1015. Double *list, *link, *link2;
  1016.     
  1017. ...
  1018.  
  1019.     
  1020. list = doubleAttachEnd (list, doubleGetNewLink());
  1021.     
  1022. link = list->next;
  1023.     
  1024. ...
  1025.  
  1026.     
  1027. link2 = doubleGetNewLink();
  1028.     
  1029. list = doubleInsertLink (list, link, link2);
  1030.     
  1031. ...
  1032. }
  1033.  
  1034. error: if either of the pointers passed into the function are invalid then a 
  1035. NULL is returned.
  1036.  
  1037. doubleSearch
  1038.  
  1039. Double *doubleSearch (data, list)
  1040. void   *data;
  1041. Double *list;
  1042.  
  1043. The first argument to this function is a pointer to the data that will be 
  1044. searched for.  The function parses through the list, the second argument, 
  1045. comparing the pointer to the 
  1046. Double->data
  1047.  pointer in the structure.  If found the pointer to the link is returned 
  1048. otherwise NULL is.
  1049.  
  1050. example:
  1051.  
  1052. #include "linklist.h"
  1053.  
  1054. main ()
  1055. {
  1056.     
  1057. Double *list, *link;
  1058.     
  1059. char   *data = "data";
  1060.     
  1061. ...
  1062.  
  1063.     
  1064. link->data = data;
  1065.     
  1066. ...
  1067.  
  1068.     
  1069. if ( !(doubleSearch (data, list)))
  1070.     
  1071.     
  1072. printf ("Data not found\n");
  1073.     
  1074. ...
  1075. }
  1076.  
  1077. error: if the pointer to the list is invalid, a NULL is returned.
  1078.  
  1079. 2.4 Circular List Functions
  1080.  
  1081. The following functions are to be used with circular linked lists.  These 
  1082. functions use links that only point in one direction (the next link) and end up 
  1083. connecting back at the start. Because of the sometimes unique behavior of 
  1084. circular links, some of the functions here may not behave in the expected way, 
  1085. i.e. a pointer to a link other than expected.  These may appear as bugs but 
  1086. there should be no great concern as the functions return the most reliable 
  1087. pointers and since the list is circular there is no loss of data through these 
  1088. functions.
  1089.  
  1090. circleAttachEnd
  1091.  
  1092. Circle *circleAttachEnd (list, link)
  1093. Circle *list;
  1094. Circle *link;
  1095.  
  1096. This function attaches the link to the 'end' of the list.  There really is no 
  1097. end in a circular list.  The function pareses through the list until it finds 
  1098. the start and then it attaches the link just before the start and points the 
  1099. link to the start completing the circle again.
  1100.  
  1101. example:
  1102.  
  1103. #include "linklist.h"
  1104.  
  1105. main ()
  1106. {
  1107.     
  1108. Circle *list;
  1109.     
  1110. ...
  1111.  
  1112.     
  1113. list = circleAttachEnd (list, circleGetNewLink());
  1114.     
  1115. ...
  1116. }
  1117.  
  1118. error: NULL is returned if either of the arguments are invalid pointers.
  1119.  
  1120. circleDeleteLink
  1121.  
  1122. Circle *circleDeleteLink (list, link)
  1123. Circle *list;
  1124. Circle *link;
  1125.  
  1126. This is one of the functions that may not return the expected pointer into the 
  1127. list.  If the pointer being passed in as the list is the one destroyed then the 
  1128. pointer becomes unstable.  To avoid loss of data the link that points to this 
  1129. link is the one that is passed back.  This function does not free any memory 
  1130. that is allocated deeper in the 
  1131. Circle->data
  1132.  pointer.  This memory must be freed before the link is destroyed.
  1133.  
  1134. example:
  1135.  
  1136. #include "linklist.h"
  1137.  
  1138. main ()
  1139. {
  1140.     
  1141. Circle *list, *link;
  1142.     
  1143. ...
  1144.  
  1145.     
  1146. list = circleDeleteLink (list, link);
  1147.     
  1148. ...
  1149. }
  1150.  
  1151. error: returns a NULL if either of the arguments are invalid pointers.
  1152.  
  1153. circleDestroyList
  1154.  
  1155. void circleDestroyList (list)
  1156. Circle *list;
  1157.  
  1158. The use of this function is pretty much straight forward - destroy the whole 
  1159. list.  The function parses through the list to find the end and then one by one 
  1160. frees the memory to each link.
  1161.  
  1162. NOTE: This function does not free the memory pointed to by the 
  1163. Circle->data
  1164.  pointer.  It would be simple to do this but if it was a pointer to another 
  1165. structure that had memory pointer in it, there would be serious memory leaks.  
  1166. Any memory that has been allocated inside this pointer must be freed before 
  1167. calling this function.
  1168.  
  1169. example:
  1170.  
  1171. #include "linklist.h"
  1172.  
  1173. main ()
  1174. {
  1175.     
  1176. Circle *list;
  1177.     
  1178. ...
  1179.  
  1180.     
  1181. circleDestroyList (list);
  1182.     
  1183. exit (0);
  1184. }
  1185.  
  1186. error: no error condition is returned.  If the pointer passed to the function 
  1187. is invalid, the function returns without releasing the memory back to the 
  1188. system causing a possible memory leak.
  1189.  
  1190. circleGetNewLink
  1191.  
  1192. Circle *circleGetNewLink (void)
  1193.  
  1194. The function returns a pointer to the new link.
  1195.  
  1196. example:
  1197.  
  1198. #include "linklist.h"
  1199.  
  1200. main ()
  1201. {
  1202.     
  1203. Circle *link;
  1204.     
  1205. link = circleGetNewLink ();
  1206. }
  1207.  
  1208. error: if the memory could not be allocated then a NULL pointer is returned.
  1209.  
  1210. circleInsertLink
  1211.  
  1212. Circle *circleInsertLink (before, new)
  1213. Circle *before;
  1214. Circle *new;
  1215.  
  1216. This function is used to insert a link somewhere in the list.  This function 
  1217. can be used to attach links to the proverbial end of the list.
  1218.  
  1219. example:
  1220.  
  1221. #include "linklist.h"
  1222.  
  1223. main ()
  1224. {
  1225.     
  1226. Circle *list, *link;
  1227.  
  1228.     
  1229. list = circleStartList (circleGetNewLink());
  1230.     
  1231. link = circleGetNewLink ();
  1232.     
  1233. /* attach link to the end of the list */
  1234.     
  1235. list = circleInsertList (list, link);
  1236.     
  1237. /* now there are two links in the list */
  1238.     
  1239. ...
  1240. }
  1241.  
  1242. error: a NULL is returned if either of the arguments passed are invalid 
  1243. pointers.
  1244.  
  1245. circleSearch
  1246.  
  1247. Circle *circleSearch (data, list)
  1248. void   *data;
  1249. Circle *list;
  1250.  
  1251. As with the other search functions this one also parses through the list 
  1252. looking at the 
  1253. Circle->data
  1254.  pointer.  If a match is found it returns the pointer to the link and returns 
  1255. NULL if one is not.
  1256.  
  1257. example:
  1258.  
  1259. #include "linklist.h"
  1260.  
  1261. main ()
  1262. {
  1263.     
  1264. Circle *list, *link;
  1265.     
  1266. char   *data = "data";
  1267.     
  1268. ...
  1269.  
  1270.     
  1271. link->data = data;
  1272.     
  1273. ...
  1274.  
  1275.     
  1276. if ( (circleSearch (data, list)))
  1277.     
  1278.     
  1279. printf ("Found %s\n", data);
  1280.     
  1281. ...
  1282. }
  1283.  
  1284. error: if the pointer passed into the function is invalid then a NULL is 
  1285. returned.
  1286.  
  1287. circleStartList
  1288.  
  1289. Circle *circleStartList (list)
  1290. Circle *list;
  1291.  
  1292. This is a very important function.  The first link in the list must be passed 
  1293. into this function before the list can be used at all.  This function starts 
  1294. the circular pointer.  It returns the pointer to the start of the list.
  1295.  
  1296. example:
  1297.  
  1298. #include "linklist.h"
  1299.  
  1300. main ()
  1301. {
  1302.     
  1303. Circle *list;
  1304.  
  1305.     
  1306. list = circleGetNewLink ();
  1307.     
  1308. list = circleStartList (list);
  1309.     
  1310. ...
  1311. }
  1312.  
  1313. error: if the argument is an invalid pointer then the function will return 
  1314. NULL.
  1315.  
  1316. Library Functions
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365. Programmers Reference
  1366.     
  1367.     
  1368.     
  1369.     
  1370.     
  1371.     
  1372.     
  1373.     
  1374.  
  1375. Page 18
  1376.  
  1377. 3. Example Code
  1378.  
  1379. 3.1 Code example for single linked lists
  1380.  
  1381. single_test.c
  1382.  
  1383. /*=========================================================
  1384.   == PROGRAM NAME : single_test.c                        ==
  1385.   == --------------------------------------------------- ==
  1386.   == DESCRIPTION : program to test the linklist library  ==
  1387.   =========================================================
  1388. */
  1389.  
  1390. #include <stdio.h>
  1391. #include <string.h>
  1392. #include <stdlib.h>
  1393. #include "linklist.h"
  1394.  
  1395. void print_list (Single *);
  1396.  
  1397. main (argc, argv)
  1398. int     argc;
  1399. char  **argv;
  1400.  
  1401. {
  1402.   char *numbers[5] = {"one", "two", "three", "four", "five"};
  1403.   int  i;
  1404.  
  1405.   Single  *list, *link;
  1406.   Single  *temp_list;
  1407.  
  1408.   /*
  1409.    * start the linked list
  1410.    */
  1411.   list = singleGetNewLink ();
  1412.   list->data = numbers[0];
  1413.  
  1414.   /*
  1415.    * start putting the rest of the links into
  1416.    * the list
  1417.    */
  1418.   for (i = 1; i < 4; i ++) {
  1419.     link = singleGetNewLink ();
  1420.     link->data = numbers[i];
  1421.     list = singleAttachEnd (list, link);
  1422.  
  1423.   }
  1424.   
  1425.   printf ("Initial list\n");
  1426.   print_list (list);
  1427.  
  1428.   /*
  1429.    * insert a link in the middle
  1430.    */
  1431.   link = singleGetNewLink ();
  1432.   link->data = numbers[4];
  1433.  
  1434.   temp_list = list;
  1435.   temp_list = temp_list->next;
  1436.   temp_list = singleInsertLink (temp_list, link);
  1437.  
  1438.   printf ("List after insert\n");
  1439.   print_list (list);
  1440.  
  1441.   /*
  1442.    * put a link at the start;
  1443.    */
  1444.   link = singleGetNewLink ();
  1445.   link->data = (char *)malloc (strlen("Start of list") +1);
  1446.   strcpy (link->data, "Start of list");
  1447.   list = singleAttachBegin (list, link);
  1448.   print_list (list);
  1449.  
  1450.   /*
  1451.    * try the search and destroy stuff 
  1452.    */
  1453.  
  1454.   if ((link = singleSearch (numbers[3], list)))
  1455.     list = singleDeleteLink (list, link);
  1456.  
  1457.   printf ("List after the search and delete\n");
  1458.   print_list (list);
  1459.  
  1460.   /*
  1461.    * get rid of the last link
  1462.    */
  1463.   list = singleDeleteLink (list, singleFindEnd (list));
  1464.   printf ("List after deleting the last link\n");
  1465.   print_list (list);
  1466.  
  1467.   /*
  1468.    * get rid of the list
  1469.    */
  1470.  
  1471.   singleDestroyList (list);
  1472.  
  1473.   return (0);
  1474. }
  1475.  
  1476. /*
  1477.  * print_list ()
  1478.  */
  1479.  
  1480. void print_list (list)
  1481. Single  *list;
  1482.  
  1483. {
  1484.  
  1485.   while (list->next != NULL) {
  1486.     printf ("data = %s\n", list->data);
  1487.     list = list->next;
  1488.   }
  1489.  
  1490.   /*
  1491.    * print the last link
  1492.    */
  1493.   printf ("data = %s\n", list->data);
  1494. }
  1495.  
  1496. 3.2 Code example for double linked lists
  1497.  
  1498. double_test.c
  1499.  
  1500. /*=========================================================
  1501.   == PROGRAM NAME : double_test.c                        ==
  1502.   == --------------------------------------------------- ==
  1503.   == DESCRIPTION :  test the double linked list          ==
  1504.   =========================================================
  1505. */
  1506.  
  1507. #include <stdio.h>
  1508. #include <string.h>
  1509. #include <stdlib.h>
  1510. #include <exec/memory.h>
  1511. #include <proto/exec.h>
  1512. #include "linklist.h"
  1513.  
  1514. void print_list (Double *);
  1515.  
  1516. main (argc, argv)
  1517. int    argc;
  1518. char **argv;
  1519.  
  1520. {
  1521.  
  1522.   char  *ones[5] = {"one", "two", "three", "four", "five"};
  1523.   char  *tens[5] = {"ten", "twenty", "thirty", "fourty", "fifty"};
  1524.   int    i;
  1525.  
  1526.   Double  *list, *link;
  1527.  
  1528.   /*
  1529.    * start the linked list
  1530.    */
  1531.   list = doubleGetNewLink ();
  1532.   list->data = ones[0];
  1533.  
  1534.   /*
  1535.    * add some more links
  1536.    */
  1537.   for (i = 1; i < 5; i ++) {
  1538.     link = doubleGetNewLink ();
  1539.     link->data = ones[i];
  1540.     list = doubleAttachEnd (list, link);
  1541.   }
  1542.  
  1543.   printf ("List after initial creation\n");
  1544.   print_list (list);
  1545.  
  1546.   /*
  1547.    * put a new link at the start and insert
  1548.    * some others in the middle
  1549.    */
  1550.   link = doubleGetNewLink ();
  1551.   link->data = tens[0];
  1552.   list = doubleAttachBegin (list, link);
  1553.  
  1554.   for (i = 1; i < 5; i ++) {
  1555.     link = doubleGetNewLink ();
  1556.     link->data = tens[i];
  1557.     list = doubleInsertLink (doubleSearch (ones[i-1], list), link);
  1558.   }
  1559.  
  1560.   printf ("after the inserts\n");
  1561.   print_list (list);
  1562.  
  1563.   /*
  1564.    * get rid of the first and last links
  1565.    */
  1566.   list = doubleDeleteLink (list, doubleFindBegin (list));
  1567.   list = doubleDeleteLink (list, doubleFindEnd (list));
  1568.  
  1569.   printf ("After removing the first and last links\n");
  1570.   print_list (list);
  1571.  
  1572.   /*
  1573.    * now that we are done, get rid
  1574.    * of the whole list.
  1575.    */
  1576.   doubleDestroyList (list);
  1577.  
  1578. }
  1579.  
  1580. /*
  1581.  * print_list ()
  1582.  */
  1583.  
  1584. void print_list (list)
  1585. Double  *list;
  1586.  
  1587. {
  1588.  
  1589.   /*
  1590.    * find the start of the list
  1591.    */
  1592.  
  1593.   while (list->prev != NULL)
  1594.     list = list->prev;
  1595.  
  1596.   /*
  1597.    * now print it
  1598.    */
  1599.  
  1600.   while (list->next != NULL) {
  1601.     printf ("data = %s\n", list->data);
  1602.     list = list->next;
  1603.   }
  1604.  
  1605.   /*
  1606.    * print the last link
  1607.    */
  1608.   printf ("data = %s\n", list->data);
  1609.  
  1610. }
  1611.  
  1612. 3.3 Code example for circular linked lists
  1613.  
  1614. circle_test.c
  1615.  
  1616. /*=========================================================
  1617.   == PROGRAM NAME : circle_test.c                        ==
  1618.   == --------------------------------------------------- ==
  1619.   == DESCRIPTION : test the circular list                ==
  1620.   =========================================================
  1621. */
  1622.  
  1623. #include <stdio.h>
  1624. #include <string.h>
  1625. #include <stdlib.h>
  1626. #include <exec/memory.h>
  1627. #include <proto/exec.h>
  1628. #include "linklist.h"
  1629.  
  1630. void print_list (Circle *);
  1631.  
  1632. main (argc, argv)
  1633. int    argc;
  1634. char **argv;
  1635.  
  1636. {
  1637.  
  1638.   char  *ones[5] = {"one", "two", "three", "four", "five"};
  1639.   char  *tens[5] = {"ten", "twenty", "thirty", "fourty", "fifty"};
  1640.   int    i;
  1641.  
  1642.   Circle  *list, *link;
  1643.  
  1644.   /*
  1645.    * start the list
  1646.    */
  1647.   list = circleGetNewLink ();
  1648.   list->data = ones[0];
  1649.  
  1650.   /*
  1651.    * initialize the list
  1652.    * doesn't need to be here since 'circleGetNewLink ()'
  1653.    * initializes the list but here for user created
  1654.    * list structures
  1655.    */
  1656.  
  1657.   list = circleStartList (list);
  1658.  
  1659.   /*
  1660.    * add some more links
  1661.    */
  1662.   for (i = 1; i < 5; i ++) {
  1663.     link = circleGetNewLink ();
  1664.     link->data = ones[i];
  1665.     list = circleAttachEnd (list, link);
  1666.   }
  1667.  
  1668.   printf ("After inital list create\n");
  1669.   print_list (list);
  1670.  
  1671.   /*
  1672.    * insert some new links
  1673.    */
  1674.   for (i = 0; i < 5; i ++) {
  1675.     link = circleGetNewLink ();
  1676.     link->data = tens[i];
  1677.     list = circleInsertLink (circleSearch (ones[i], list), link);
  1678.   }
  1679.  
  1680.   printf ("After the insert\n");
  1681.  
  1682.   /*
  1683.    * The following print will look like a bug since the 'data = one'
  1684.    * is no longer on the top.  This happened because of the way the
  1685.    * insert was performed.  Since it is a circular list the end is
  1686.    * attached to the start and there is no loss of data.
  1687.    */
  1688.   print_list (list);
  1689.  
  1690.   /*
  1691.    * delete a link
  1692.    */
  1693.   list = circleDeleteLink (list, circleSearch (ones[3], list));
  1694.  
  1695.   printf ("After the delete\n");
  1696.   print_list (list);
  1697.  
  1698.   /*
  1699.    * done with the test, get rid of the list
  1700.    */
  1701.   circleDestroyList (list);
  1702.  
  1703. }
  1704.  
  1705. /*
  1706.  * print_list ()
  1707.  */
  1708.  
  1709. void print_list (list)
  1710. Circle  *list;
  1711.  
  1712. {
  1713.  
  1714.   Circle  *temp_list;
  1715.  
  1716.   /*
  1717.    * start printing the list and then loop
  1718.    * until the next link in temp_list is
  1719.    * the same as the list passed in.
  1720.    */
  1721.  
  1722.   temp_list = list;
  1723.  
  1724.   while (temp_list->next != list) {
  1725.     printf ("data = %s\n", temp_list->data);
  1726.     temp_list = temp_list->next;
  1727.   }
  1728.  
  1729.   /*
  1730.    * print that last link
  1731.    */
  1732.   printf ("data = %s\n", temp_list->data);
  1733.  
  1734. }
  1735. Example Code
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784. Programmers Reference
  1785.     
  1786.     
  1787.     
  1788.     
  1789.     
  1790.     
  1791.     
  1792.     
  1793.  
  1794. Page 26
  1795.  
  1796. Appendix A
  1797.  
  1798. Code History and Changes
  1799.  
  1800. Version 1.0
  1801. Initial release.
  1802.  
  1803. Version 1.1
  1804. Added a new function 
  1805. singleAttachBegin()
  1806.  to the library.
  1807.  
  1808. Changed the functions 
  1809. singleInsertLink()
  1810. doubleInsertLink()
  1811. , and 
  1812. circleInsertLink()
  1813. .
  1814.  
  1815. singleInsertLink (before, after, link);
  1816.     
  1817. /*v 1.0*/
  1818. singleInsertLink (before, link);
  1819.     
  1820.     
  1821.     
  1822. /*v 1.1*/
  1823.  
  1824. doubleInsertLink (before, after, link);
  1825.     
  1826. /*v 1.0*/
  1827. doubleInsertLink (before, link);
  1828.     
  1829.     
  1830.     
  1831. /*v 1.1*/
  1832.  
  1833. circleInsertLink (before, after, link);
  1834.     
  1835. /*v 1.0*/
  1836. circleInsertLink (before, link);
  1837.     
  1838.     
  1839.     
  1840. /*v 1.1*/
  1841.  
  1842. The function 
  1843. circleStartList()
  1844. , which creates a one link circular link to initialize the list, is no longer 
  1845. needed.  Now 
  1846. circleGetNewLink()
  1847.  correctly initializes the new list by doing this function
  1848. . It is still left in the library for compatability to version 1.0 and to 
  1849. initialize any user created list structures.
  1850.  
  1851. All of the functions that take link pointers as arguments now have error 
  1852. checking in them.  If an invalid pointer is passed into the function a NULL 
  1853. pointer is returned.  This keeps the library from crashing any programs due to 
  1854. SEGV errors.
  1855. Appendix A
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.  
  1862.  
  1863.  
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904. Programmers Reference
  1905.     
  1906.     
  1907.     
  1908.     
  1909.     
  1910.     
  1911.     
  1912.     
  1913.  
  1914. Page 27
  1915.  
  1916. Index
  1917.  
  1918. C
  1919. changes    27
  1920. circleAttachEnd    16, 25
  1921. circleDeleteLink    16-17, 25
  1922. circleDestroyList    3, 17, 26
  1923. circleGetNewLink    16-19, 25, 27
  1924. circleInsertLink    18, 25, 27
  1925. circleSearch    18, 25
  1926. circleStartList    18-19, 25, 27
  1927. circular link struct    1
  1928. circular list functions    2, 16
  1929.  
  1930. D
  1931. double link struct    1
  1932. double list functions    2, 10
  1933. doubleAttachBegin    10, 12, 14, 23
  1934. doubleAttachEnd    10-11, 14, 23
  1935. doubleDeleteLink    11, 13, 23
  1936. doubleDestroyList    2, 11-12, 23
  1937. doubleFindBegin    12, 23
  1938. doubleFindEnd    12-13, 23
  1939. doubleGetNewLink    10-11, 13-14, 22-23
  1940. doubleInsertLink    13-14, 23, 27
  1941. doubleSearch    14
  1942.  
  1943. F
  1944. free    6-7, 11, 16-17
  1945. free memory    6
  1946.  
  1947. H
  1948. history    27
  1949.  
  1950. L
  1951. library    1-2, 4, 20, 27
  1952. linklist.h    1
  1953. linklist.lib    1
  1954.  
  1955. M
  1956. memory    1-2, 4-8, 10-11, 13, 16-18
  1957. memory leak    2, 5-6, 17
  1958.  
  1959. S
  1960. SEGV    27
  1961. single link struct    1
  1962. single list functions    2, 5
  1963. singleAttachBegin    5, 21, 27
  1964. singleAttachEnd    5-6, 8, 20
  1965. singleDeleteLink    6-7, 21
  1966. singleDestroyList    2, 6-7, 21
  1967. singleFindEnd    7, 21
  1968. singleGetNewLink    5-6, 8, 20-21
  1969. singleInsertLink    8, 13, 21, 27
  1970. singleSearch    9, 21
  1971. standard list functions    2
  1972. stdGetNewLink    4
  1973.  
  1974. V
  1975. version    27
  1976.  
  1977.  
  1978.